package com.ticket.sass.provider.dto.output.resource;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Map;

/**
 * @author ywb
 * @date 2022-01-07 16:21
 */
@Data
@ApiModel(value = "递归资源Out")
public class RecursionResourceOutput implements Comparable<RecursionResourceOutput> {
    @ApiModelProperty("资源ID")
    private Integer id;
    
    private String name;
    
    @ApiModelProperty(value = "资源等级")
    private Integer level;
    
    @ApiModelProperty("资源父ID")
    private Integer parentId;
    
    @ApiModelProperty("排序")
    private Integer sort;

    @ApiModelProperty(value = "权限标识符")
    private String perms;
    
    @ApiModelProperty(value = "备注")
    private String remark;
    
    @ApiModelProperty(value = "数据")
    private Map<String, Object> data;

    @ApiModelProperty("菜单资源")
    private List<RecursionResourceOutput> children;
    
    @Override
    public int compareTo(@NotNull RecursionResourceOutput o) {
        return this.sort.compareTo(o.getSort());
    }
    
    public RecursionResourceOutput(Integer id, String name, Integer level, Integer parentId, Integer sort, String perms, String remark, Map<String, Object> data) {
        this.id = id;
        this.name = name;
        this.level = level;
        this.parentId = parentId;
        this.sort = sort;
        this.perms = perms;
        this.remark = remark;
        this.data = data;
    }
    

    
}
